package com.thon.service.system.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.system.AttachmentDao;
import com.thon.entity.system.Attachment;
import com.thon.service.system.AttachmentService;


/**
 * @author THON
 * @email thon.ju@meet-future.com
 * @date 2011-11-24 上午10:41:06
 * @description:
 */
@Service
@Transactional
public class AttachmentServiceImpl implements AttachmentService {

	@Autowired
	private AttachmentDao attachmentDao;
	
	public AttachmentServiceImpl() {
	}
	
	public Attachment getAttachment(int attachmentId) {
		return attachmentDao.get(attachmentId);
	}

	public void saveAttachment(Attachment attachment) {
		if(attachment.getId()==null) {
			attachmentDao.save(attachment);
		} else {
			attachmentDao.update(attachment);
		}
	}

	public void deleteAttachment(Attachment attachment) {
		attachmentDao.delete(attachment.getId());
	}

}
